#include "XMLController.h"

int XMLController::getInt( xmlNode* node, const char* attribute)
{
    return atoi((const char*) xmlGetProp(node, (xmlChar*)attribute));
}

float XMLController::getFloat( xmlNode* node, const char* attribute)
{
    return atof((const char*) xmlGetProp(node, (xmlChar*)attribute));
}

const char* XMLController::getString( xmlNode* node, const char* attribute)
{
    return (const char*) xmlGetProp(node, (xmlChar*)attribute);
}

void XMLController::parseVector2(const char* s, Vector2 &v2)
{
    sscanf(s, "%f %f", &v2[0], &v2[1]);
}

void XMLController::parseVector3(const char* s, Vector3 &v3)
{
    sscanf(s, "%f %f %f", &v3[0], &v3[1], &v3[2]);
}

void XMLController::parseVector4(const char* s, Vector4 &v4)
{
    sscanf(s, "%f %f %f %f", &v4[0], &v4[1], &v4[2], &v4[3]);
}

void XMLController::parseVector4(const char* s, float v4[4])
{
    sscanf(s, "%f %f %f %f", &v4[0], &v4[1], &v4[2], &v4[3]);
}

void XMLController::parseVector5(const char* s, int v5[5])
{
    sscanf(s, "%i %i %i %i %i", &v5[0], &v5[1], &v5[2], &v5[3], &v5[4]);
}
